package tk.winshu.enums;

import lombok.Getter;

/**
 * @author Kevin
 * @since 2019/5/20
 */
@Getter
public enum WeekDay {

    /**
     */
    MONDAY(1, "星期一"),
    TUESDAY(2, "星期二"),
    WEDNESDAY(3, "星期三"),
    THURSDAY(4, "星期四"),
    FRIDAY(5, "星期五"),
    SATURDAY(6, "星期六"),
    SUNDAY(7, "星期日");

    private int key;
    private String value;

    WeekDay(int key, String value) {
        this.key = key;
        this.value = value;
    }

    public static WeekDay fromKey(int weekDayKey) {
        for (WeekDay weekDay : WeekDay.values()) {
            if (weekDay.key == weekDayKey) {
                return weekDay;
            }
        }
        return null;
    }
}
